include ../makeEnviroment.conf

BUILD_ROOT_DIR=./build/

SRCS = $(wildcard *.c)
CFLAGS += -I./
$(info srcs: $(SRCS))
OBJS = $(patsubst %.c,$(BUILD_ROOT_DIR)%.o,$(SRCS))
$(info objs: $(OBJS))

TARGET_A = $(BUILD_ROOT_DIR)libmodbase.a

all: makeBuildingDirs $(OBJS)
	# 静态库
	$(AR) -r $(TARGET_A) $(OBJS)
	### 更新静态库的符号索引表. 大部分项目已经不使用它了,因为ar -s就做了ranlib的工作。
	$(RANLIB) $(TARGET_A)

$(OBJS):$(BUILD_ROOT_DIR)%.o:%.c
	$(GCC) -c $^ -o $@ $(CFLAGS)

makeBuildingDirs:
	mkdir -p $(BUILD_ROOT_DIR)

clean:
	rm -rf *.o $(TARGET_A) $(OBJS) $(BUILD_ROOT_DIR)
